<%@ page contentType="text/html; charset=UTF-8"%>
<%@page import="com.biz.conf.Global"%>
<%@ include file="/jsp/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>jqGird</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="favicon.ico">
    <link href="${ctxStatic}/plugins/h+/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/animate.min.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/style.min862f.css?v=4.1.0" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="${ctxStatic}/plugins/h+/css/plugins/webuploader/webuploader.css">
    <link href="${ctxStatic}/plugins/h+/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <style>
        .ml10 {
            margin-left: 15px;
        }
        .wddd-list-jtzl {
            padding: 10px 0 0 !important;
            text-align: center;
        }.wddd-list-jtzl>ul>li {
             float: left;
             cursor: pointer;
         }
        ul,li{
            list-style-type: none;
        }

    </style>

</head>

<body class="gray-bg" >
<div class="panel blank-panel">
    <div class="panel-heading">
        <div class="panel-options">
            <ul class="nav nav-tabs">
                <li class="active" style="width:50%;"><a data-toggle="tab" href="tabs_panels.html#tab-1"><i class="fa fa-user"></i>现金订单</a>
                </li>
                <li class="" style="width:50%;"><a data-toggle="tab" href="tabs_panels.html#tab-2"><i class="fa fa-weixin"></i>积分订单</a>
                </li>
            </ul>
        </div>
    </div>
    <div class="panel-body">
        <div class="tab-content">
            <div id="tab-1" class="tab-pane active">
                <div class="wrapper wrapper-content  animated fadeInRight" id="ccbb">
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="toolbar">
                                <div id="toolbar">
                                    <button onclick="order_excel_deshopMain(0);" class="btn btn-primary"><i class="fa fa-file-excel-o"></i>&nbsp;导出订单</button>
                                    <%-- <button onclick="order_excel_deshop();" class="btn btn-primary"><i class="fa fa-file-excel-o"></i>&nbsp;导出订单明细</button>--%>
                                </div>
                            </div>
                            <span id="spancc" class="spancc"></span>
                            <div class="row">
                                <div class="ibox float-e-margins">
                                    <div class="ibox-title">
                                        <h5>搜索条件</h5>
                                        <div class="ibox-tools">
                                            <a class="collapse-link">
                                                <i class="fa fa-chevron-up"></i>
                                            </a>
                                        </div>
                                    </div>
                                    <div class="ibox-content" >
                                        <div class="row">
                                            <div class="col-md-2"><input placeholder="订单号" id="search_code" class="form-control" ></div>

                                            <div class="col-md-2"><input placeholder="开始日期" id="search_startdate" class="form-control layer-date" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})" ></div>
                                            <div class="col-md-2"><input placeholder="结束日期" id="search_enddate" class="form-control layer-date" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})" ></div>
                                            <div class="col-md-1"><button id="btn_search" class="btn btn-primary"><i class="fa fa-search"></i>&nbsp;搜索</button></div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <table id="exampleTablePagination"></table>
                        </div>
                    </div>
                </div>
            </div>
            <div id="tab-2" class="tab-pane active">
                <div class="wrapper wrapper-content  animated fadeInRight" id="ccbb2">
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="toolbar">
                                <div id="toolbar2">
                                    <button onclick="order_excel_deshopMain(1);" class="btn btn-primary"><i class="fa fa-file-excel-o"></i>&nbsp;导出订单</button>
                                    <%-- <button onclick="order_excel_deshop();" class="btn btn-primary"><i class="fa fa-file-excel-o"></i>&nbsp;导出订单明细</button>--%>
                                </div>
                            </div>
                            <span id="spancc2" class="spancc"></span>
                            <div class="row">
                                <div class="ibox float-e-margins">
                                    <div class="ibox-title">
                                        <h5>搜索条件</h5>
                                        <div class="ibox-tools">
                                            <a class="collapse-link">
                                                <i class="fa fa-chevron-up"></i>
                                            </a>
                                        </div>
                                    </div>
                                    <div class="ibox-content" >
                                        <div class="row">
                                            <div class="col-md-2"><input placeholder="订单号" id="search_code2" class="form-control" ></div>
                                            <div class="col-md-2"><input placeholder="开始日期" id="search_startdate2" class="form-control layer-date" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})" ></div>
                                            <div class="col-md-2"><input placeholder="结束日期" id="search_enddate2" class="form-control layer-date" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})" ></div>
                                            <div class="col-md-1"><button id="btn_search2" class="btn btn-primary"><i class="fa fa-search"></i>&nbsp;搜索</button></div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <table id="exampleTablePagination2"></table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<script src="${ctxStatic}/plugins/h+/js/jquery.min.js?v=2.1.4"></script>
<script src="${ctxStatic}/plugins/h+/js/bootstrap.min.js?v=3.3.6"></script>
<script src="${ctxStatic}/plugins/h+/js/plugins/bootstrap-table-master/bootstrap-table.js"></script>
<script src="${ctxStatic}/plugins/h+/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="${ctxStatic}/plugins/h+/js/plugins/bootstrap-table-master/locale/bootstrap-table-zh-CN.js"></script>
<script src="${ctxStatic}/plugins/h+/js/plugins/bootstrap-table-master/extensions/export/bootstrap-table-export.js"></script>
<script src="${ctxStatic}/plugins/h+/js/plugins/bootstrap-table-master/extensions/editable/bootstrap-table-editable.js"></script>
<script src="${ctxStatic}/plugins/h+/js/plugins/sweetalert/sweetalert.min.js"></script>
<script src="${ctxStatic}/plugins/h+/js/content.min.js?v=1.0.0"></script>
<script src="${ctxStatic}/plugins/h+/js/plugins/layer/laydate/laydate.js"></script>
<script src="${ctxStatic}/plugins/h+/js/plugins/layer2.4/layer.js"></script>

<script>

</script>
<script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script>
<script type="text/javascript">
    //初始化表格对象
    var $table = $('#exampleTablePagination');
    var $table2 = $('#exampleTablePagination2');
    /*
     获取选中行的相关数据
     */
    $(function () {
        $table.on('click-row.bs.table', function (e, row, $element) {
            $('.success').removeClass('success');
            $($element).addClass('success');
        });
        $table2.on('click-row.bs.table', function (e, row, $element) {
            $('.success').removeClass('success');
            $($element).addClass('success');
        });
        $('#button').click(function () {
            alert('Selected name: ' + getSelectedRow().userName);
        });
    });
    function getSelectedRow() {
        var index = $table.find('tr.success').data('index');
        return $table.bootstrapTable('getData')[index];
    }

    /*
     每一列详情格式化数据
     */
    function formDetail(index, row) {
        return row.detail+index;
    }


    function showPopup(id,detailId){
        //自定页
        layer.open({
            type: 2,
            shift:2,//动画类型
            moveType:1,
            maxmin: true,
            shadeClose: true, //开启遮罩关闭
            title:'<span style="font-weight:600;font-size: 13px;color:#676a6c;">订单详情</span>',
            area: ['700px', '530px'],
            content: '${pageContext.request.contextPath}/order/toDetail.ac?id='
            + id+'&detailId='+detailId,
            success: function(layero, index){
                var datas={"firstname":"555555"};
                var body = layer.getChildFrame('body', index);
                //var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象，执行iframe页的方法：iframeWin.method();
                console.log(body.html()); //得到iframe页的body内容
            },
            cancel: function(index){
//                alert(index);
                return true;
            }
        });
    }



    function showDeliverPop(mainid,detailId, message,takeWay){
        //自定页
        layer.open({
            type: 2,
            shift:2,//动画类型
            moveType:1,
            maxmin: true,
            shadeClose: true, //开启遮罩关闭
            title:'<span style="font-weight:600;font-size: 13px;color:#676a6c;">发货单</span>',
            area: ['400px', '480px'],
            content: '${pageContext.request.contextPath}/order/orderSendList.ac?orderid='
            + mainid+'&detailId='+detailId+'&message='+window.encodeURI(window.encodeURI(message))+'&takeWay='+takeWay,
            success: function(layero, index){
//                var datas={"firstname":"555555"};
//                var body = layer.getChildFrame('body', index);
//                //var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象，执行iframe页的方法：iframeWin.method();
//                console.log(body.html()); //得到iframe页的body内容
            },
            cancel: function(index){
//                alert(index);
                return true;
            }
        });
    }


    ////////////////////////////////////////////////////////////////////////////////////////以下是通过js方式初始化BootStrapTable/////////////////////////////////////////////

    $table.bootstrapTable({
        url: "${pageContext.request.contextPath}/order/showOrders.ac?goodsType=0",
        method: 'post',
        contentType: "application/x-www-form-urlencoded",//必须的
        dataType: "json",
        pageList:[10, 20, 50, 100],//会根据当前的数据量加载合适的pageList
        height: ($(window).height()-100) ,
        //cardView:true,//是否自适应手机
        pagination: true, //分页
        // queryParamsType: "limit",
        singleSelect: false,
        cache:false,
        sortName:"createTime",
        search: false, //显示搜索框
        showColumns:false,
        showRefresh:false,
        showToggle:false,
        showPaginationSwitch:false,
        smartDisplay:true,
        detailView:true,
        toolbar:"#toolbar",
        queryParams: queryParams,//参数
        searchOnEnterKey:true,
        detailFormatter:function(index, record, element){
            var html='</br>';
            html+='<div class=\"wddd-list-jtzl\">'+
            '<ul style="margin-top:10px;"  >'+
            '<li style=\"width:20%\">购买人:</li>'+
            '<li style=\"width:20%\">'+record.buyerName+'</li>'+
                /*'<li style=\"width:20%\">买家留言:</li>'+
                 '<li style=\"width:40%;word-wrap:break-word;\"> <div style="width:400px;word-wrap:break-word;">'+record.buyNotes+'</div></li>'+*/
            '</ul>'+
            '<br class="clear"/>'+
            '<ul style="margin-top:10px;">'+
            '<li style=\"width:20%;line-height:20px;\">商品信息:'+record.goodsName+'<br>'+record.type1Name+record.type2Name+record.type3Name+'</li>';
            if(record.mainType == '3'){
                html+='<li style=\"width:20%;line-height:20px;\"><img src="<%=Global.getConfig("OSSURL_mainType3")%>/';
            }else{
                html+='<li style=\"width:20%;line-height:20px;\"><img src="<%=Global.getConfig("OSSURL")%>/';
            }
            html+= record.goodsPath
            + '" width="100" height="100"></li>'
            + '<li style=\"width:20%;line-height:20px;\">售价:'
            + record.goodPrice
            + '</li>'
            + '<li style=\"width:40%;line-height:20px;\">数量:'
            + record.count
            + '</li>'
            + '</ul>';
            '<br class="clear"/>'+
            + '<ul style="margin-top:10px;">'
            + '<li style=\"width:20% \"></li>'
            + '<li style=\"width:40% \"></li>'
            + '<li style=\"width:20%\"></li>'
            + '<li style=\"width:20%\"></li>' + '</ul>';
            '<br class="clear"/>';
            return html;
        },
        sidePagination: "server", //服务端处理分页
        columns: [

            {field:'mainId', title:'编号', type:'string', align: 'center',visible:false},
            {field:'code', title:'订单编号', type:'string', align: 'center'},
            {field:'paycode',title:'支付单号', type:'string', align: 'center'},
            {field:'goodsName', title:'商品名称', type:'string', align: 'center',formatter:function(value){
                if(value.length>10)
                {
                    return value.substring(0,9)+"...";
                }else{
                    return value;
                }
            }},
            {field:'goodsType', title:'订单类型', type:'string', align: 'center',formatter:function(value){
                if(value==0)
                {
                    return '<span style="color:green">现金订单</span>';
                }else if(value==1){
                    return '<span style="color:blue">积分订单</span>';
                }
            }},
            {field:'createTime', title:'下单时间', type:'string', align: 'center'},
            {field:'scoreTotal', title:'积分金额', type:'string', align: 'center'},
            {field:'payTotal', title:'现金金额', type:'string', align: 'center',formatter:function(value){
                return value+'元';
            }},
            {field:'detailState', title:'订单状态', type:'string',align: 'center',formatter:function(value, record, column, grid, dataNo,
                                                                                                 columnNo){
                if (value==0){
                    return "<font color='red'>待付款</font>";
                } else if(value==1)  {
                    //return "<font color='green'>待发货</font>";
                    return '<button class="btn btn-xs btn-danger"  onclick="showDeliverPop(\''+record.mainId+'\',\''+record.detailId+'\',\''+record.message+'\',\''+record.takeWay+'\');">发货</button>';
                }else if(value==2){
                    return "待收货";
                }else if(value==3){
                    return "待评价";
                }else if(value==4){
                    return "完成";
                }else if(value==5){
                    return "退款中";
                }else if(value==6){
                    return "已退款";
                }else if(value==7){
                    return "待备货";
                }else{
                    return "备货前退款";
                }
            }},
            {field:'mainState',title:'付款状态', type:'string',align: 'center',formatter:function(value){
                if (value==0){
                    return "<font color='red'>未付款</font>";
                } else if(value==1)  {
                    return "<font color='green'>已付款</font>";
                }
            }},
            {field:'isClosed', title:'关闭状态', type:'string',align: 'center',formatter:function(value,record){
                if (value==0){
                    return "<font color='green'>正常</font>";
                } else if(value==1)  {
                    return "<font color='red'>已关闭</font>";
                }
            }},{
                title: '操作',
                align: 'center',
                formatter:function(value,row,index){
                    if(row.isClosed == 0)
                    {
                        return [
                            '<a class="search" onclick="showPopup(\''+row.mainId+'\',\''+row.detailId+'\');" href="javascript:void(0)" title="详情">',
                            '<i class="glyphicon glyphicon-search"></i>',
                            '</a>&nbsp;&nbsp;&nbsp;&nbsp;',
                            '<a class="remove" onclick="closeOrder(\''+row.mainId+'\',0);" href="javascript:void(0)" title="关闭">',
                            '<i class="glyphicon glyphicon-remove"></i>',
                            '</a>',
                        ].join('');
                    }else{
                        return [
                            '&nbsp;&nbsp;&nbsp;&nbsp;<a class="search" onclick="showPopup(\''+row.mainId+'\',\''+row.detailId+'\');" href="javascript:void(0)" title="详情">',
                            '<i class="glyphicon glyphicon-search"></i>',
                            '</a>&nbsp;&nbsp;&nbsp;&nbsp;',
                        ].join('');
                    }
                }
            }
        ]
    });


    $table2.bootstrapTable({
        url: "${pageContext.request.contextPath}/order/showOrders.ac?goodsType=1",
        method: 'post',
        contentType: "application/x-www-form-urlencoded",//必须的
        dataType: "json",
        pageList:[10, 20, 50, 100],//会根据当前的数据量加载合适的pageList
        height: ($(window).height()-100) ,
        //cardView:true,//是否自适应手机
        pagination: true, //分页
        // queryParamsType: "limit",
        singleSelect: false,
        cache:false,
        sortName:"createTime",
        search: false, //显示搜索框
        showColumns:false,
        showRefresh:false,
        showToggle:false,
        showPaginationSwitch:false,
        smartDisplay:true,
        detailView:true,
        toolbar:"#toolbar2",
        queryParams: queryParams,//参数
        searchOnEnterKey:true,
        detailFormatter:function(index, record, element){
            var html='</br>';
            html+='<div class=\"wddd-list-jtzl\">'+
            '<ul style="margin-top:10px;"  >'+
            '<li style=\"width:20%\">购买人:</li>'+
            '<li style=\"width:20%\">'+record.buyerName+'</li>'+
                /*'<li style=\"width:20%\">买家留言:</li>'+
                 '<li style=\"width:40%;word-wrap:break-word;\"> <div style="width:400px;word-wrap:break-word;">'+record.buyNotes+'</div></li>'+*/
            '</ul>'+
            '<br class="clear"/>'+
            '<ul style="margin-top:10px;">'+
            '<li style=\"width:20%;line-height:20px;\">商品信息:'+record.goodsName+'<br>'+record.type1Name+record.type2Name+record.type3Name+'</li>';
            if(record.mainType == '3'){
                html+='<li style=\"width:20%;line-height:20px;\"><img src="<%=Global.getConfig("OSSURL_mainType3")%>/';
            }else{
                html+='<li style=\"width:20%;line-height:20px;\"><img src="<%=Global.getConfig("OSSURL")%>/';
            }
            html+= record.goodsPath
            + '" width="100" height="100"></li>'
            + '<li style=\"width:20%;line-height:20px;\">售价:'
            + record.goodPrice
            + '</li>'
            + '<li style=\"width:40%;line-height:20px;\">数量:'
            + record.count
            + '</li>'
            + '</ul>';
            '<br class="clear"/>'+
            + '<ul style="margin-top:10px;">'
            + '<li style=\"width:20% \"></li>'
            + '<li style=\"width:40% \"></li>'
            + '<li style=\"width:20%\"></li>'
            + '<li style=\"width:20%\"></li>' + '</ul>';
            '<br class="clear"/>';
            return html;
        },
        sidePagination: "server", //服务端处理分页
        columns: [

            {field:'mainId', title:'编号', type:'string', align: 'center',visible:false},
            {field:'code', title:'订单编号', type:'string', align: 'center'},
            {field:'paycode',title:'支付单号', type:'string', align: 'center'},
            {field:'goodsName', title:'商品名称', type:'string', align: 'center',formatter:function(value){
                if(value.length>10)
                {
                    return value.substring(0,9)+"...";
                }else{
                    return value;
                }
            }},
            {field:'goodsType', title:'订单类型', type:'string', align: 'center',formatter:function(value){
                if(value==0)
                {
                    return '<span style="color:green">现金订单</span>';
                }else if(value==1){
                    return '<span style="color:blue">积分订单</span>';
                }
            }},
            {field:'createTime', title:'下单时间', type:'string', align: 'center'},
            {field:'scoreTotal', title:'积分金额', type:'string', align: 'center'},
            {field:'payTotal', title:'现金金额', type:'string', align: 'center',formatter:function(value){
                return value+'元';
            }},
            {field:'detailState', title:'订单状态', type:'string',align: 'center',formatter:function(value, record, column, grid, dataNo,
                                                                                                 columnNo){
                if (value==0){
                    return "<font color='red'>待付款</font>";
                } else if(value==1)  {
                    //return "<font color='green'>待发货</font>";
                    return '<button class="btn btn-xs btn-danger"  onclick="showDeliverPop(\''+record.mainId+'\',\''+record.detailId+'\',\''+record.message+'\',\''+record.takeWay+'\');">发货</button>';
                }else if(value==2){
                    return "待收货";
                }else if(value==3){
                    return "待评价";
                }else if(value==4){
                    return "完成";
                }else if(value==5){
                    return "退款中";
                }else if(value==6){
                    return "已退款";
                }else if(value==7){
                    return "待备货";
                }else{
                    return "备货前退款";
                }
            }},
            {field:'mainState',title:'付款状态', type:'string',align: 'center',formatter:function(value){
                if (value==0){
                    return "<font color='red'>未付款</font>";
                } else if(value==1)  {
                    return "<font color='green'>已付款</font>";
                }
            }},
            {field:'isClosed', title:'关闭状态', type:'string',align: 'center',formatter:function(value,record){
                if (value==0){
                    return "<font color='green'>正常</font>";
                } else if(value==1)  {
                    return "<font color='red'>已关闭</font>";
                }
            }},{
                title: '操作',
                align: 'center',
                formatter:function(value,row,index){
                    if(row.isClosed == 0)
                    {
                        return [
                            '<a class="search" onclick="showPopup(\''+row.mainId+'\',\''+row.detailId+'\');" href="javascript:void(0)" title="详情">',
                            '<i class="glyphicon glyphicon-search"></i>',
                            '</a>&nbsp;&nbsp;&nbsp;&nbsp;',
                            '<a class="remove" onclick="closeOrder(\''+row.mainId+'\',1);" href="javascript:void(0)" title="关闭">',
                            '<i class="glyphicon glyphicon-remove"></i>',
                            '</a>',
                        ].join('');
                    }else{
                        return [
                            '&nbsp;&nbsp;&nbsp;&nbsp;<a class="search" onclick="showPopup(\''+row.mainId+'\',\''+row.detailId+'\');" href="javascript:void(0)" title="详情">',
                            '<i class="glyphicon glyphicon-search"></i>',
                            '</a>&nbsp;&nbsp;&nbsp;&nbsp;',
                        ].join('');
                    }
                }
            }
        ]
    });

    /*
     搜索按钮
     */
    $("#btn_search").click(function(){
        $table.bootstrapTable('selectPage', 1);
        $table.bootstrapTable('refresh', queryParams);
    });

    $("#btn_search2").click(function(){
        $table2.bootstrapTable('selectPage', 1);
        $table2.bootstrapTable('refresh', queryParams2);
    });

    /*
     传递的参数
     */
    function queryParams(params) {
        var temp = {  //这里的键的名字和控制器的变量名必须一直，这边改动，控制器也需要改成一样的
            limit: params.limit,  //页面大小
            offset: params.offset, //页码
            pageindex:params.pageNumber,
            code: $("#search_code").val(),
            goodsType:0,
            startDate: $("#search_startdate").val(),
            endDate: $("#search_enddate").val()
        };
        return temp;
    }

    function queryParams2(params) {
        var temp = {  //这里的键的名字和控制器的变量名必须一直，这边改动，控制器也需要改成一样的
            limit: params.limit,  //页面大小
            offset: params.offset, //页码
            pageindex:params.pageNumber,
            code: $("#search_code2").val(),
            goodsType:1,
            startDate: $("#search_startdate2").val(),
            endDate: $("#search_enddate2").val()
        };
        return temp;
    }
    ///////////////////////////////////////////////////////////////toolbar///////////////////////////////////////
    //新增
    $("#btn_add").click(function(){
        showPopup();
    });

    //批量删除
    $("#btn_del").click(function(){
        var ids=getSelections();
        //执行批量删除
        deleteGrid(ids);
    });

    /*
     批量删除方法体
     */
    function closeOrder(mainId,type){
        swal({
            title: "您确定要关闭此订单吗？",
            text: "关闭后将无法恢复，请谨慎操作！",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "关闭",
            cancelButtonText:"取消",
            closeOnConfirm: false
        }, function () {
            //执行批量删除
            $.ajax( {
                url:'${pageContext.request.contextPath}/order/closeOrder.ac',
                data:{
                    id :mainId
                },
                type:'post',
                cache:false,
                dataType:'json',
                success:function(data) {
                    if(data.state == '1'){
                        swal("关闭成功！", "您已经关闭了这个订单。", "success");
                        //当前表格刷新
                        if(type==0)
                        {
                            $table.bootstrapTable('refresh');
                        }else if(type==1)
                        {
                            $table2.bootstrapTable('refresh');
                        }

                    }else{
                        swal("删除失败！", "未能关闭此订单。", "error");
                    }
                },
                error : function() {
                    alert("异常！");
                }
            });

        });
    }

    // 打开订单详情
    function openDetail(id,detailId) {
        window.location.href = "${pageContext.request.contextPath}/order/toDetail.ac?id="
        + id+"&detailId="+detailId;
    }

    //获取选中的CheckBox
    $("#btn_getCheck").click(function(){
        alert('getSelections: ' + JSON.stringify($table.bootstrapTable('getSelections')));
        alert("客户信息:"+$table.bootstrapTable('getSelections')[0].userName);
    });

    function order_excel_deshopMain(type) {

        var params = {};
        if(type==0)
        {
            params['startDate'] = $("#search_startdate").val();
            params['endDate'] = $("#search_enddate").val();
            params['code'] = $("#search_code").val();
        }else if(type==1)
        {
            params['startDate'] = $("#search_startdate2").val();
            params['endDate'] = $("#search_enddate2").val();
            params['code'] = $("#search_code2").val();
        }

        params['goodsType'] = type;

        var str = encodeURI(encodeURI(JSON.stringify(params)));
        window.location.href = "${pageContext.request.contextPath}/order/exportExcel_shopDeMain.ac?parameters="
        + str;
    }

    function order_excel_deshop() {
        var params = {};
        var params = {};
        params['startdate'] = $("#search_startdate").val();
        params['enddate'] = $("#search_enddate").val();
        params['code'] = $("#search_code").val();
        params['goodsType'] = $("#q_type").val();

        var str = encodeURI(encodeURI(JSON.stringify(params)));

        window.location.href = "${pageContext.request.contextPath}/order/exportExcel_shopDeDetail.ac?parameters="
        + str;
    }



    <%--function DeliverGoods(mainid, message) {--%>
    <%--$("#form_type").val("0");--%>
    <%--$(':input', '#form').val('');--%>
    <%--$("#doc-modal-1").modal('open');--%>
    <%--$("#form_id").val(mainid);//选中的orderid--%>

    <%--$("#select_sandType").val(1);//默认自己配送--%>
    <%--selectUrlType();--%>
    <%--$--%>
    <%--.ajax({--%>
    <%--url : '${pageContext.request.contextPath}/order/orderSendList.action?orderid='--%>
    <%--+ mainid,--%>
    <%--type : 'post',--%>
    <%--success : function(data) {--%>
    <%--var jsondate = JSON.parse(data);--%>
    <%--$("#select_recPersonName").html(--%>
    <%--jsondate[0].recPersonName);//收件人姓名--%>
    <%--$("#select_userphone").html(jsondate[0].userphone);//收件人电话--%>
    <%--$("#select_buyAddr").html(jsondate[0].buyAddr);//地址--%>
    <%--$("#select_message").html(message);//留言--%>

    <%--}--%>
    <%--});--%>

    <%--}--%>


    function reloadTable(){
        $table.bootstrapTable('refresh');
        $table2.bootstrapTable('refresh');
    }

</script>
</body>


</html>
